package com.hnkywl.sts.action.flow.endState;


import com.hnkywl.sts.entity.jhgl.Jkd;
import com.hnkywl.sts.service.jhgl.JkdService;
import com.hnkywl.sts.service.sys.YgService;
import com.hnkywl.sts.util.ApplicationInstance;
import org.jbpm.api.listener.EventListener;
import org.jbpm.api.listener.EventListenerExecution;

/**
 * Created with IntelliJ IDEA.
 * User: jerry
 * Date: 13-5-8
 * Time: 下午11:34
 * To change this template use File | Settings | File Templates.
 */
public class EndDzjkdState implements EventListener {

    @Override
    public void notify(EventListenerExecution execution) throws Exception {
        // 改变状态  ytj--->ysp
        JkdService jkdService = ApplicationInstance.createJkdService();
        Jkd jkd = jkdService.findJkdDetailByProcessInstance(execution.getProcessInstance().getId());
        jkd.setZt("ysp");
        if (jkd.getSpr() == null)
            jkd.setSpr(YgService.getCurrentYg());
        jkdService.updateJkd(jkd);
    }
}
